import re
import os
from glob import glob
import shutil
import sys
import json
import time
import datetime
import numpy as np
import pandas as pd
import cv2
import matplotlib.pyplot as plt
from PIL import Image

# 这两行代码解决 plt 中文显示的问题
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
np.random.seed(0)


# img_path
def plt_img(img):
    cv2.imwrite("out.jpg", img)
    img = cv2.imread("out.jpg")
    # img = Image.open("out.jpg")
    # img = np.array(img)
    plt.imshow(img)
    plt.show()


# Create a black image
img = np.zeros((512, 512, 3), np.uint8)
# img[100, 100] = [255, 255, 255]
# px = img[100, 100]
# print(px)
# blue = img[100, 100, 0]
# print(blue)

print(img.item(10, 10, 2))
img.itemset((10, 10, 2), 100)
print(img.item(10, 10, 2))

# Draw a diagonal blue line with thickness of 5 px
# cv2.line(img, (0, 0), (511, 511), (255, 0, 0), 5)
# plt.imshow(img)
# plt.show()
